//
//  HWTopicsMoreCollectionViewCell.m
//  HappyWeekend
//
//  Created by 赵洁 on 16/1/13.
//  Copyright © 2016年 com.mjykj.www. All rights reserved.
//

#import "HWTopicsMoreCollectionViewCell.h"

@implementation HWTopicsMoreCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        CGFloat w = frame.size.width;
        _image = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenWidth-w)/2, 0,w, frame.size.height)];
        //_image.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_image];
        _titleLable = [[UILabel alloc]initWithFrame:CGRectMake(10, _image.height-30, _image.width,30)];
        _titleLable.numberOfLines = 0;
        _titleLable.font = [UIFont boldSystemFontOfSize:15];
        _titleLable.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_titleLable];
        
        _likeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _likeButton.frame = CGRectMake(_image.width-100, 20, 80, 40);
        _likeButton.layer.cornerRadius = 10;
        _likeButton.backgroundColor = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f];
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 30, 30)];
        imageView.image = [UIImage imageNamed:@"iconfont-31guanzhu1"];
        [_likeButton addSubview:imageView];
        _likeLable = [[UILabel alloc]initWithFrame:CGRectMake(imageView.right, imageView.top+5, 50, 20)];
        _likeLable.numberOfLines = 0;
        //_likeLable.text = @"123456";
        _likeLable.textColor = [UIColor whiteColor];
        _likeLable.font = [UIFont systemFontOfSize:10];
        [_likeButton addSubview:_likeLable];
        
        [self.contentView addSubview:_likeButton];
        
        
    }
    return self;
}

- (void)setModel:(HWTopicsMoreModel *)model
{
    _model = model;
    [_image sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url]];
    _titleLable.text = model.title;//
    
    //把nsnumber转字符串
    _likeLable.text = [model.likes_count description];
}


@end
